﻿using System;
using UnityEngine;

// Token: 0x0200000A RID: 10
public class CrippledScript : MonoBehaviour
{
	// Token: 0x0600002E RID: 46 RVA: 0x00007163 File Offset: 0x00005363
	private void Start()
	{
		this.energy = 100f;
		this.body = base.GetComponent<BodyScript>();
	}

	// Token: 0x0600002F RID: 47 RVA: 0x0000717C File Offset: 0x0000537C
	private void Update()
	{
		bool flag = false;
		if (this.body.hitStun <= 0f)
		{
			if (this.body.fallTime <= 0f && this.body.jumpCooldown > 0f)
			{
				this.energy -= Time.deltaTime * 20f;
				flag = true;
			}
			if (this.body.isAttacking)
			{
				this.energy -= Time.deltaTime * 7f;
				flag = true;
			}
			if (this.body.isBlocking)
			{
				flag = true;
			}
			if (this.body.shoveCooldown >= 0.5f)
			{
				this.energy -= Time.deltaTime * 8f;
				flag = true;
			}
		}
		if (!flag)
		{
			this.energy += Time.deltaTime * 8f;
			if (this.energy > 100f)
			{
				this.energy = 100f;
			}
		}
		if (this.energy < 0f)
		{
			this.body.hitStun = 4f;
			this.body.knockOutTime = 2.5f;
			this.energy = 0f;
		}
		this.energyIndicator.position = this.body.head.transform.position + Vector3.up * 1.35f;
		this.energyBack.position = this.energyIndicator.position;
		this.energyIndicator.localScale = new Vector2(Mathf.Lerp(this.energyIndicator.localScale.x, this.energy * 0.01f, Time.deltaTime * 4f), 1f);
	}

	// Token: 0x040000AA RID: 170
	private BodyScript body;

	// Token: 0x040000AB RID: 171
	public float energy;

	// Token: 0x040000AC RID: 172
	public float maxEnergyIndWidth;

	// Token: 0x040000AD RID: 173
	public Transform energyIndicator;

	// Token: 0x040000AE RID: 174
	public Transform energyBack;
}
